@extends('layouts.supervisor')

@section('content')

<style type="text/css">
.delegate{margin:10px;}
</style>
<div class="page-content">
    <div class="page-header">
        <h1>审核学生开题报告</h1>
    </div>
    <div class="row">
        <div class="col-xs-12">
            <div class="row form-horizontal">
               <form id="thesis_proposal_form" name="thesis_proposal_form" class="form-horizontal" method="POST" action="/supervisor/thesis/storeproposalfile" enctype="multipart/form-data">
                    {{ csrf_field() }}
                    <input  type="hidden" name="student_id" value="{{$student->id}}" />
                    <label class="col-xs-12 col-sm-2 control-label no-padding-right alert alert-block alert-success"> 导师上传审批后版本 </label>
                    <div class="form-actions col-xs-12 col-sm-6" style="margin-top:0px; margin-left:5px;background:#f5f5f5">
                        <div class="input-group col-xs-12 col-sm-12">
                            <input type="file" class="form-control" name="proposal" />
                            <br/>
                            <input class="form-control" type="text" name="comment" placeholder="请输入说明" />
                            <div class="hr hr16 hr-dotted"></div>
                            <button style="width:50%; margin-left:25%;" class="btn btn-info btn-sm form-control" type="button" onclick="event.preventDefault(); document.getElementById('thesis_proposal_form').submit();">
                                <i class="icon-ok bigger-110"></i>
                                上传  
                            </button>
                            @if (count($errors) > 0)
                            <div class="hr hr16 hr-dotted"></div>
                            <div class="space-4"></div>
                            <div class="alert alert-danger">
                                <ul>
                                    @foreach ($errors->all() as $error)
                                    <li>{{ $error }}</li>
                                    @endforeach
                                </ul>
                            </div>
                            @endif

                            @if ($edit == true)
                            <div class="space-4"></div>
                            <div class="alert alert-danger">
                                修改成功
                            </div>
                            @endif    
                        </div>
                    </div>
                </form>
            </div>
            <div class="hr hr16 hr-double"></div>
            <div class="row form-horizontal">
                <label class="col-xs-12 col-sm-2 control-label no-padding-right alert alert-block alert-success"> 所有版本开题报告</label>
                <div class="col-xs-12 col-sm-6" style="margin-top:0px; margin-left:5px;background:#f5f5f5">
                    <div id="profile-feed-1" class="profile-feed">
                        @foreach($history as $item)
                        <div class="profile-activity clearfix">
                            <div>
                                
                                <a class="user" href="/download/proposals/{{$item->proposal}}">{{$item->proposal}}  
                                @if($item->by_supervisor)
                                <span class="label label-warning arrowed arrowed-right">@if($item->current)最新版@endif 导师提交</span>
                                @else
                                <span class="label label-success arrowed-in arrowed-in-right">@if($item->current)最新版@endif 学生提交</span> 
                                @endif
                                </a>
                                <div class="time">
                                    <i class="icon-time bigger-110" style="margin-right:5px;"></i>提交时间: {{$item->created_at}} 
                                   <p style="word-wrap:break-word"><i class="icon-comment bigger-110" style="margin-right:5px;"></i>说明: {{$item->comment}}</p>
                                </div>
                            </div>
                        </div>
                        @endforeach
                    </div>
                </div>
            </div>
            <div class="hr hr16 hr-double"></div>
            <div class="row form-horizontal">
                <label class="col-xs-12 col-sm-2 control-label no-padding-right alert alert-block alert-success"> 和学生讨论修改意见 </label>
                 <div class="col-xs-12 col-sm-6" style="margin-top:0px; margin-left:5px; background:#f5f5f5">
                    @include('comment', $commentInfo)
                </div>      
            </div>
            <div class="hr hr16 hr-double"></div>
            <div class="row form-horizontal">
               <label class="alert alert-block alert-success col-xs-12 col-sm-2 control-label no-padding-right"> 导师最终意见 </label>
                 <div class="form-actions col-xs-12 col-sm-6" style="margin-top:0px; margin-left:5px;">
                    @if($thesis->proposal_approved)
                    <span class="label label-success arrowed-in arrowed-in-right" style="font-size:16px; height:24px;">审批通过</span>
                    @else
                    <form id="title-form" name="title-form" class="form-horizontal" method="POST" action="/supervisor/thesis/storeproposal" >
                        {{ csrf_field() }}
                        <input type="hidden" class="col-xs-10 col-sm-5" id='student' name="student" value="{{$student->id}}" />
                         <button class="btn btn-info btn-sm" type="button" onclick="event.preventDefault(); document.getElementById('title-form').submit();">
                            <i class="icon-ok bigger-110"></i>
                            确认通过
                        </button>
                    </form>
                    @endif
                </div>
            </div>
        </div>
    </div>

</div>

<script type="text/javascript">
    @if($history->count() > 0)
    $('#profile-feed-1').slimScroll({
        height: '150px',
        alwaysVisible : false
    });
    @endif
</script>
@endsection



